#include <func.h>

int main()
{
    int fds[2];
    pipe(fds);//fds[0]为读端，fds[1]为写端
    if(!fork())
    {
        //子进程
        close(fds[0]);
        write(fds[1],"hello",5);
        exit(0);
    }else{
        //父进程
        close(fds[1]);
        char buf[1000]={0};
        read(fds[0],buf,sizeof(buf));
        puts(buf);
        wait(NULL);
        exit(0);
    }

}